﻿using System;
using FluentNHibernate;
using FluentNHibernate.Conventions;

namespace Insesoft.Entities.Repository
{
    public class ForeingKeyNamingConvention : ForeignKeyConvention
    {
        protected override string GetKeyName(Member property, Type type)
        {
            if (property == null)
                // This line will disable `KeyColumnConvention`
                return type.Name + "Id";

            // This line has no effect when `ReferenceKeyConvention` is enabled.
            return property.Name + "Id";
        }
    }
}